package com.lwj.springbootvue.exception;

import com.lwj.springbootvue.constants.HttpStatus;

/**
 * 自定义的业务异常。当我们的系统出现异常时，返回该异常给前端
 */
public class ServiceException extends RuntimeException{

    private static final long serialVersionUID = 1L;


    /**
     * 错误码
     */
    private int status;
    /**
     * 错误提示
     */
    private String message;
    /**
     * 错误明细，内部调试错误
     */
    private String detailMessage;



    /**
     * 空构造方法，避免反序列化问题
     */
    public ServiceException(){

    }


    public ServiceException(int status,String message) {
        this.message=message;
        this.status = status;
    }

    public ServiceException(String message, int status) {
        this.message=message;
        this.status = status;
    }

    public ServiceException(int status, String message, String detailMessage) {
        this.status = status;
        this.message = message;
        this.detailMessage = detailMessage;
    }



    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getDetailMessage() {
        return detailMessage;
    }

    public void setDetailMessage(String detailMessage) {
        this.detailMessage = detailMessage;
    }
}
